<?php
/**
 * Created by PhpStorm.
 * User: mojie126
 * Date: 2017/6/2
 * Time: 下午5:11
 */

namespace app\index\model;

use think\Model;

class Users extends Model
{
	static public function getUserInfo($uid)
	{
		$res = Users::get($uid);

		return $res->data;
	}

	static public function getUserName($uid)
	{
		$res = Users::get($uid)->getAttr("username");

		return $res;
	}

	static public function getUserUUID($uid)
	{
		$res = Users::get($uid)->getAttr("uuid");

		return $res;
	}

	static public function getUserAdmin($uid)
	{
		if (!empty($uid)) {
			$res = Users::get($uid)->getAttr("isadmin");
		} else {
			$res = FALSE;
		}

		return $res;
	}

	static public function getUserInfoFromExtract($extract)
	{
		$res = Users::get(["extract" => $extract]);

		if ($res) {
			return $res->data;
		} else {
			return FALSE;
		}
	}
}